<? foreach($transaction as $row){ 
        if($row['result_code'] == '000'){
            $color = "#b0f0b0";

        }elseif($row['result_code'] == '400' OR $row['result'] == 'AUTOREVERSED' OR $row['result'] == 'REVERSED'){      
            $color = "#B2D1F0";

        }elseif($row['result_code'] == '???' OR $row['result'] == 'CREATED' OR $row['result'] == 'TIMEOUT' OR $row['result'] == 'PENDING'){
            $color = "#f3f3f3"; 

        }else{
            $color = "#ffbaba"; 
        }

        if($row['dms_ok'] == 'NO' AND $row['result_code'] == '000'){
            $makedmstrans = "<td style='text-align: center;'><a class='transakcija dmsok' href=".site_url()."transaction/confirm_dms/".$row['id'].">makeDMStrans</a></td>";
        }elseif($row['dms_ok'] == 'YES'){
            $makedmstrans = '<td style="color: gray; text-align: center;">DMS done; amount='.$row['makeDMS_amount'].'</td>';
        }else{
            $makedmstrans = '<td>---</td>'; 
        }

        if($row['result_code']=='000' AND $row['result'] =='OK'){
            $reverse = "<td style='text-align: center;'><a class='transakcija dmsreverse' href=".site_url()."transaction/confirm_reverse/".$row['id'].">REVERSE</a></td>";

        }elseif($row['result']=='REVERSED' AND $row['reversal_amount'] == '0'){
            $reverse = '<td style="color: gray; text-align: center;">Autoreversal</td>';

        }elseif($row['result_code']=='400' OR $row['result']=='REVERSED'){
            $reverse = '<td style="color: gray; text-align: center;">Reversed; amount='.$row['reversal_amount'].'</td>';

        }else{
            $reverse = '<td style="color: gray;">---</td>';
        }

        $update = " <td style='text-align: center;'><a href='?action=update&id=". $row['id'] ."'>Update</a></td>";


    ?>



    <tr>
        <td style="text-align: center;"><?=$row['id']?></td>
        <td><?
            $time = strtotime( $row['t_date'] );            
            echo date('d.m.Y G:i:s', $time);
            ?></td>
        <td><? if($row['currency']=="978") echo "&euro; ";?><?=$row['amount']?></td>
        <td><?=$row['client_ip_addr']?></td>
        <td><?=$row['description']?></td>
        <td style="background-color:<?=$color?> ;"><?=$row['result']?></td>
        <td><?=$row['result_code']?></td>
        <?=$makedmstrans?>
        <?=$reverse?>

    </tr>
    <? };  ?>
